%link
\begin{lstlisting}
AZ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
PT = strip_encoding(open("Plaintext/blackcat.txt").read())
Diff1 = "AHXCOYFBAMKUE"
Diff2 = "XHXRGEUHPRAHN"
eps = 0.15
for k in range(12):
    D1 = Diff1[[k,k+1]]; D2 = Diff2[[k,k+1]];
    FD = relative_differential_probabilities(D1,D2,PT)
    r1 = AZ.index(D1[0]); s1 = AZ.index(D1[1])
    r2 = AZ.index(D2[0]); s2 = AZ.index(D2[2])
    print "k: %s" % k
    for i1 in range(26):
        for j1 in range(26):
            AB = AZ[i1] + AZ[j1]
            if FD.has_key(AB) and FD[AB] > eps:
                i2 = (i1-r1) % 26; j2 = (j1-s1) % 26
                i3 = (i1-r2) % 26; j3 = (j1-s2) % 26
                print "  [%s,%s,%s]: %s" % (
                    AZ[[i1,j1]], AZ[[i2,j2]], AZ[[i3,j3]], FD[i1,j1])
\end{lstlisting}%link
